<template>
<slot :controller="controller" :store="store" :model="model" >
  <div :class="classNames" >
    <AppSheet :name="model.codeName" :config="store.data" :enableDesign="store.enableDesign" v-if="store.isLoaded"></AppSheet>
    <template v-else>
      <AppEmptyDataTip></AppEmptyDataTip>
    </template>
  </div>
</slot>
</template>
<script setup lang="ts">
// 基于template/src/widgets/{{appEntities}}/{{ctrls@REPORTPANEL}}-report-panel/{{spinalCase ctrl.codeName}}-report-panel-base.vue.hbs生成
import { AppSheet } from '@components/widgets/sheet';

import { IContext, IParam, IViewLogicInput } from "@/core";
import { ReportPanelActionType, IReportPanelAbility, IReportPanelStore } from "@/core";
import { ReportpanelControlVO } from './report-report-panel-vo';
import { useProps, useBasic, useAction, useController } from './report-report-panel-hook';

const attrs = useAttrs();

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { controlID, getClassNames, model ,useNavParamsBind, useEventBind, handleActionClick, handleComponentAction } = useBasic(props);

const emit = defineEmits<{
    (event: 'ctrl-action', name: string, action: ReportPanelActionType, data: IParam[]): void;
    (event: 'ctrl-init', name: string, data: IReportPanelAbility): void;
    (event: 'ctrl-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
//  部件样式名
const classNames = computed(() => {
  return getClassNames(props);
});

//  报表控制器
const controller = useController(props, evt, { controlID, attrs });

useNavParamsBind(controller, props);

const store: IReportPanelStore = controller.getStore();

onMounted(() => {
    controller.ctrlMounted();
});
onUnmounted(() => {
    controller.ctrlDestroy();
})
</script>
